gtafandomcom-20200222-history
Unit
Distances are measured differently in some editions of Grand Theft Auto. In early editions (GTA 1 and GTA 2) measurements are based on the grid system of the landscape data file format. In later editions, they use meters and divisions of meters. None of the environments in any Grand Theft Auto edition attempt to mimic the Earth's curvature, they use flat planes and straight lines to base positions from. GTA 1 and GTA 2 The map data for these levels is constructed from a grid of cubes. There are 256 cubes from East to West and 256 cubes from North to South. There are 6 layers of cubes, creating a total of 393,216 cubes. In both editions, the face of each cube is able to take one texture of size 64×64 pixels. This provides a regular grid which can be used for the placement of objects. Negative values are not required in GTA1 and GTA2, as the whole environment is covered by positive coordinates. Cube Coordinates A cube in GTA1 and GTA2 is the same size as the length of a regular 1990s American family car, which tend to be around 4.5 meters long (some are larger, some are smaller). Therefore, each side of a cube in GTA 1 and GTA 2 is 4.5 meters long. This makes the game environment 1,152 meters from East to West and the same amount from North to South. In contrast, it allows just 27 meters in height. The total game area is 1,327,104 square meters, or 1.327 square kilometers. Coordinates in these games start from the upper North West corner of the environment at (0,0,0) and finish in the South East corner at (255,255,5). In GTA 1, these coordinates must all be integers but in GTA 2, decimals can be used, such as (12.3,98.75,3.5). Integer cube coordinates place an object precisely on the North West corner of a cube. Sea level is generally placed on the lowest level to allow all of the very limited height to be used by buildings. Pixel Coordinates Because GTA 2 can use decimals in its cube coordinates system, it does not need a more precise unit. However, GTA 1 does require a more precise unit and it uses the location of pixels on the faces of cubes to do this. They start from the upper North West corner of the environment at (0,0,0) to the South East corner at (16383,16383,383). There are 64 pixels to a cube. A pixel coordinate which can be divided by 64 with no remainder will place an object precisely at the North East corner of a cube. An offset of 32 pixels will place an object precisely in the center of a cube. Exceptions Some objects in GTA 1 and GTA 2 have an offset from the coordinate system, most notably the TELEPHONE object in GTA 1 (creates a payphone from which the player can receive missions) and the TOWER object in GTA 2 (to make special walls and towers solid). Some objects have special requirements about how they are positioned on the vertical axis (Z axis or third coordinate position). In general, objects should be created inside the cube above the cube they are intended to be placed on. However, some objects (such as DUM_MIS_TRIG in GTA1) must be placed on the cube above this. GTA III, GTA Vice City and GTA San Andreas The distance units in the 3D editions of Grand Theft Auto were standardized and based accurately on one meter. Therefore, one unit in GTA III, GTA Vice City or GTA San Andreas equals one meter. These "standard units" can use a floating point decimal but this inevitably lacks precision near the edges of the game boundaries. Therefore, much like GTA 1, a secondary coordinates system is introduced. This uses "precision unit" which are each one sixteenth of a meter (6.25 cm) and also allow decimals, creating a much more accurate coordinates system. The size of the game environment in each edition is different and became larger with each edition:- GTA III :From (-???,-???,-???) to (???,???,???) standard units. :Total area: ?.??? square kilometers. ;GTA Vice City :From (-2300,-1900,-INF.) to (1540,1900,INF.) approximately, standard units. :Total area: 14.6 square kilometers. ;GTA San Andreas :From (-3000,-3000,-INF.) to (3000,3000,INF.) standard units. :Total area: 36.0 square kilometers. Those limitations can be increased using several tools like the SA Limit Adjuster. Sea level is generally placed a little above the vertical level of the origin, normally between 0 and 100 units above it. This is to make the placement of buildings use positive numbers for their Z axis position, presumably to make the data easier for humans to understand. Standard Units These 3D editions measure positions roughly from the center of the game environment using standard graph axes. As such, positions below and to the South West of the origin are negative on all three axes while positions above and to the North East are positive in all three axes. Other positions have a mixture of negative and positive values. Each standard unit is precisely one meter in length. The maximum possible range for the type of number used is from -1.5 x 10^-45 to 3.4 x 10^38 but this is limited to the size of the game environment for most purposes. It is important to note the precision of the float single (32 bit float) data used by the games is best used within -2048..2048 units, possibly maximum of -4069..4069 units. going beyond these numbers could cause jittering vehicles, unstable and imprecise physical simulation of the game environment. Precision Units These only seem to be used by AI paths to overcome the lack of precision when creating paths near the edges of the game environment. They are measured from the exact same origin as standard units in the same directions and therefore require negative numbers to be used for some areas of the game environment. Each precision unit is precisely on sixteenth of a metre (6.25 cm) and decimals are allowed. The maximum possible range for the type of number used is from -??? to ??? but this is limited to the size of the game environment for most purposes. Exceptions GTA San Andreas allows coordinates beyond the normal game environment to be used but there are limits on how they can be used. Mission scripts allow a number of map objects to be placed beyond the boundaries. The player can freely roam beyond the boundaries. This is not a practical way to add extra land and islands to the game but it does allow extra possibilities for long distance mission scenarios. External links * CoordStudio by Cerbera - allows conversion between all units used by PC releases of Grand Theft Auto. Category:Map Formats Category:Mission Script Category:GTA 1 Category:GTA 2 Category:GTA III Modifications Category:GTA Vice City Category:Modifications